package ruleta_wicket.ruleta_wicket;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PropertyListView;

public class HomePage extends WebPage {

	private static final long serialVersionUID = 1L;

	public HomePage() {		
		add(new PropertyListView("links", this.getOpciones()) {

			@Override
			protected void populateItem(final ListItem item) {
				Link link = new Link("link") {

					@Override
					public void onClick() {
						this.setResponsePage(((MenuAction) item
								.getModelObject()).getResponsePage());
					}
				};
				link.add(new Label("linkName"));
				item.add(link);

			}
		});
	}

	 public List<MenuAction> getOpciones() {
		 List<MenuAction> opciones = new ArrayList<MenuAction>();
		 opciones.add(new MenuAction("Login", LogginPage.class));
		 return opciones;
	 }
	 
}
